/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Frmasigprofesor.java
 *
 * Created on 18/02/2011, 10:45:24 PM
 */

package interfaz1;

import java.awt.Frame;
import javax.swing.JOptionPane;

/**
 *
 * @author CLIENTE
 */
public class Frmasigprofesor extends javax.swing.JFrame {



    /** Creates new form Frmasigprofesor */
    public Frmasigprofesor() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblasigprof = new javax.swing.JLabel();
        lblcedprof = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtcedasigprof = new javax.swing.JTextField();
        txtnomasigprof = new javax.swing.JTextField();
        txtapeasigprof = new javax.swing.JTextField();
        txttitasigprof = new javax.swing.JTextField();
        btnguardarasigprof = new javax.swing.JButton();
        btncancelarasigprof = new javax.swing.JButton();
        btnsalirasigprof = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Profesor");
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        lblasigprof.setFont(new java.awt.Font("Bookman Old Style", 1, 12));
        lblasigprof.setText("Asignar Profesor");
        getContentPane().add(lblasigprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 30, 120, 20));

        lblcedprof.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblcedprof.setText("Cedula:");
        getContentPane().add(lblcedprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 70, 70, 20));

        jLabel1.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        jLabel1.setText("Nombre:");
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 100, 70, 20));

        jLabel2.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        jLabel2.setText("Apellido:");
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 130, 70, 20));

        jLabel3.setFont(new java.awt.Font("Bookman Old Style", 0, 10));
        jLabel3.setText("Titulo Obtenido:");
        getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 160, 110, 20));

        txtcedasigprof.setFont(new java.awt.Font("Bookman Old Style", 0, 10));
        getContentPane().add(txtcedasigprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 70, 120, -1));

        txtnomasigprof.setFont(new java.awt.Font("Bookman Old Style", 0, 10));
        getContentPane().add(txtnomasigprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 100, 120, -1));

        txtapeasigprof.setFont(new java.awt.Font("Bookman Old Style", 0, 10));
        getContentPane().add(txtapeasigprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 130, 120, -1));

        txttitasigprof.setFont(new java.awt.Font("Bookman Old Style", 0, 10));
        getContentPane().add(txttitasigprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 160, 120, -1));

        btnguardarasigprof.setText("Guardar");
        btnguardarasigprof.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnguardarasigprofActionPerformed(evt);
            }
        });
        getContentPane().add(btnguardarasigprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 240, -1, -1));

        btncancelarasigprof.setText("Cancelar");
        btncancelarasigprof.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btncancelarasigprofActionPerformed(evt);
            }
        });
        getContentPane().add(btncancelarasigprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 240, -1, -1));

        btnsalirasigprof.setText("Salir");
        btnsalirasigprof.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnsalirasigprofActionPerformed(evt);
            }
        });
        getContentPane().add(btnsalirasigprof, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 240, 70, -1));

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-416)/2, (screenSize.height-336)/2, 416, 336);
    }// </editor-fold>//GEN-END:initComponents

    private void btnsalirasigprofActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsalirasigprofActionPerformed

        // TODO add your handling code here:
        FrmOperacionesseccion frmopsec = new FrmOperacionesseccion();
         frmopsec.show();
         dispose();
    }//GEN-LAST:event_btnsalirasigprofActionPerformed

    private void btnguardarasigprofActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnguardarasigprofActionPerformed
        // TODO add your handling code here:

        if(!txtcedasigprof.getText().isEmpty() && !txtnomasigprof.getText().isEmpty() && !txtapeasigprof.getText().isEmpty() && !txttitasigprof.getText().isEmpty() )
        {
              FrmOperacionesseccion.getMiseccion().InscribirProfesor(new Profesor(txtcedasigprof.getText(),txtnomasigprof.getText(), txtapeasigprof.getText(),  txttitasigprof.getText()));
              FrmOperacionesseccion.setEncon(true);
              JOptionPane.showMessageDialog(new Frame(), "Profesor Asignado con exito", "Aviso", JOptionPane.PLAIN_MESSAGE);
              dispose();
        
        }
        else
        {
              JOptionPane.showMessageDialog(new Frame(), "Falta algun campo, revisar", "Aviso", JOptionPane.PLAIN_MESSAGE);
        }
    }//GEN-LAST:event_btnguardarasigprofActionPerformed

    private void btncancelarasigprofActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btncancelarasigprofActionPerformed
        // TODO add your handling code here:
        txtapeasigprof.setText("");
        txtcedasigprof.setText("");
        txtnomasigprof.setText("");
        txttitasigprof.setText("");

    }//GEN-LAST:event_btncancelarasigprofActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Frmasigprofesor().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btncancelarasigprof;
    private javax.swing.JButton btnguardarasigprof;
    private javax.swing.JButton btnsalirasigprof;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel lblasigprof;
    private javax.swing.JLabel lblcedprof;
    private javax.swing.JTextField txtapeasigprof;
    private javax.swing.JTextField txtcedasigprof;
    private javax.swing.JTextField txtnomasigprof;
    private javax.swing.JTextField txttitasigprof;
    // End of variables declaration//GEN-END:variables

}
